package com.ihr360.cnb.module.insurance.service.feign;

import com.ihr360.cnb.module.insurance.service.feign.fallback.InsuranceServiceFallback;
import com.ihr360.commons.data.util.Pair;
import com.ihr360.commons.model.type.SIHFLedgerState;
import com.ihr360.entity.ApplicationApprovalEntity;
import com.ihr360.entity.StaffBankSalaryEntity;
import com.ihr360.insurance.entity.request.StaffIdRequest;
import com.ihr360.insurance.entity.vo.BenefitCompanySettingEntity;
import com.ihr360.insurance.entity.vo.CompanyBenefitSimpleVo;
import com.ihr360.insurance.entity.vo.StaffBenefitEntity;
import com.ihr360.insurance.entity.vo.StaffBenefitVo;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author Stone.Shi
 * @description
 * @date 2018-01-25 18:16:00.
 */
@FeignClient(name = "ihr360-insurance-provider", fallback = InsuranceServiceFallback.class)
public interface InsuranceService {

    /**
     * 获取全部社保公积金方案
     *
     * @param companyId
     * @return
     */
    @RequestMapping(value = "/companyBenefits/list/simple", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
    List<CompanyBenefitSimpleVo> getCompanyBenefits(@RequestParam(value = "companyId") String companyId);

    /**
     * 获取指定的员工
     *
     * @param companyId
     * @param staffIdRequest
     * @return
     */
    @RequestMapping(value = "/staffBenefits/listin", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
    List<StaffBenefitVo> getAllStaffBenefitInclude(@RequestParam(value = "companyId") String companyId,
                                                   @RequestBody StaffIdRequest staffIdRequest);

    /**
     * 查询员工社保信息
     */
    @RequestMapping(value = "/staffBenefits/query", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
    StaffBenefitEntity queryStaffInsurance(@RequestParam(value = "companyId") String companyId, @RequestParam(value = "staffId") String staffId);

    /**
     * 保存员工社保信息
     */
    @RequestMapping(value = "/staffBenefits/baseInfo/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    void saveStaffInsurance(@RequestParam(value = "companyId") String companyId, @RequestBody StaffBenefitEntity staffBenefitEntity);

    @PostMapping("/monthlyLedgerSummaries/benefit/submit/approval")
    void saveApprovalApplicationId(@RequestParam(value = "companyId") String companyId, @RequestBody ApplicationApprovalEntity response, @RequestParam(value = "id") Long id);

    @PostMapping("/staffBenefits/saveAllInsurance")
    void saveAllInsurance(@RequestParam(value = "companyId") String companyId, @RequestBody List<StaffBankSalaryEntity> staffBankSalaryEntityList);

    /**
     * 查询公司福利审批设置
     */
    @GetMapping(value = "/benefitCompanySettings/queryBenefitCompanySetting")
    BenefitCompanySettingEntity queryBenefitCompanySetting(@RequestParam(value = "companyId") String companyId);

    /**
     * 福利关账操作
     */
    @GetMapping(value = "/monthlyLedgerSummaries/benefit/close")
    void closeLedgerSummary(@RequestParam(value = "id") Long id);

    /**
     * 福利关账操作
     */
    @GetMapping(value = "/monthlyLedgerSummaries/benefit/approval/state")
    void updateApprovalState(@RequestParam(value = "companyId") String companyId,
                             @RequestParam(value = "applicationId") String applicationId,
                             @RequestParam(value = "state") SIHFLedgerState state);

    /**
     * 获取福利台账所属用户的userId
     *
     * @return <台账数据Id,userId>
     */
    @GetMapping(value = "/monthlyLedgerSummaries/idUserId")
    Pair<Long, String> getLedgerSummaryIdUserId(@RequestParam(value = "companyId") String companyId,
                                                @RequestParam(value = "applicationId") String applicationId);

}
